package com.jkl.queryserver.Provider.DAO.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jkl.pojo.Account;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AccountMapper extends BaseMapper<Account> {
    default Account selectPUSA(String email){
        return selectOne(new QueryWrapper<Account>()
                .select("password","userName","sign","alterTime")
                .eq("email",email)
        );
    }
    default List<Account> selectLike( String email,String text){
        return selectList(new QueryWrapper<Account>().last("limit 10")
                .select("email","userName")
                .ne("email",email)
                .like("email",text)
        );
    }
    default Account selectUSA(String email){
        return selectOne(new QueryWrapper<Account>()
                .select("userName","sign","alterTime")
                .eq("email",email)
        );
    }
    default Account selectU(String email){
        return selectOne(new QueryWrapper<Account>()
                .select("userName")
                .eq("email",email)
        );
    }
}
